package com.zhiyou.test4.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.zhiyou.test4.model.PersonModel;
import com.zhiyou.test4.service.IPersonService;

@RequestMapping("/")
@Controller
public class PersonController {
	@Autowired
	IPersonService servicePerson;
	@RequestMapping("index.do")
	public String index(Model model){
	  List<PersonModel> results = servicePerson.queryPersons();
		model.addAttribute("results", results);
		return "index";
	}

	@RequestMapping("ajax.do")
	public String indexAjax(Model model){
		System.out.println("进入ajaxcontroller");
		List<PersonModel> results = servicePerson.queryPersons();
		model.addAttribute("results", results);
		return "dataTable";
	}
	
}
